﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8" />
    <title>Seminar: Seminar.cs Source File</title>
    <link href="/Content/Help.css" rel="stylesheet" type="text/css" />
    <link href="/Content/css/tabs.css" rel="stylesheet" type="text/css" />
    <link href="/Content/css/doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <div id="header">
        <img id="logo" alt="StateForge" src="/Content/Images/StateForgeLogo.png" />
        <div id="title">
            <h1>
                C# examples using state machines generated by StateBuilderDotNet
            </h1>
            <h3>
                Seminar: Seminar.cs Source File
            </h3>
        </div>
        <div id="menucontainer">
            <ul id="menu">
                <li><a href="/">Home</a></li>
                <li><a href="/Home/Download">Downloads</a></li>
                <li><a href="/Help/state-machine-tools.aspx">Help</a></li>
                <li><a href="/Home/Faq">F.A.Q</a></li>
                <li><a href="/Home/About">Contact us</a></li>
            </ul>
        </div>
    </div>
<!-- Generated by Doxygen 1.7.4 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
<div class="header">
  <div class="headertitle">
<div class="title">Seminar.cs</div>  </div>
</div>
<div class="contents">
<a href="_seminar_8cs.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 ﻿
<a name="l00002"></a>00002 
<a name="l00003"></a><a class="code" href="namespace_state_forge_1_1_examples_1_1_seminar.html">00003</a> <span class="keyword">namespace </span>StateForge.Examples.<a class="code" href="class_state_forge_1_1_examples_1_1_seminar_1_1_seminar.html" title="Seminar is a container class which hold instances of a SeminarActuator and a generated SeminarContext...">Seminar</a>
<a name="l00004"></a>00004 {
<a name="l00005"></a>00005     <span class="keyword">using</span> System;
<a name="l00006"></a>00006     <span class="keyword">using</span> System.Collections.Generic;
<a name="l00007"></a>00007 
<a name="l00008"></a><a class="code" href="class_state_forge_1_1_examples_1_1_seminar_1_1_student.html">00008</a>     <span class="keyword">public</span> <span class="keyword">class </span><a class="code" href="class_state_forge_1_1_examples_1_1_seminar_1_1_student.html">Student</a>
<a name="l00009"></a>00009     {
<a name="l00010"></a><a class="code" href="class_state_forge_1_1_examples_1_1_seminar_1_1_student.html#a81bc2a8a0a25e3693839ad71acb7c909">00010</a>         <span class="keyword">public</span> <span class="keywordtype">string</span> Name { <span class="keyword">get</span>; <span class="keyword">set</span>; }
<a name="l00011"></a>00011     }
<a name="l00012"></a>00012 
<a name="l00016"></a><a class="code" href="class_state_forge_1_1_examples_1_1_seminar_1_1_seminar_actuator.html">00016</a>     <span class="keyword">public</span> <span class="keyword">class </span><a class="code" href="class_state_forge_1_1_examples_1_1_seminar_1_1_seminar_actuator.html" title="SeminarActuator performs the actions.">SeminarActuator</a>
<a name="l00017"></a>00017     {
<a name="l00018"></a><a class="code" href="class_state_forge_1_1_examples_1_1_seminar_1_1_seminar_actuator.html#a538b68cd3445053967495ecf7aac6fcb">00018</a>         <span class="keyword">public</span> List&lt;Student&gt; studentListWaiting = <span class="keyword">new</span> List&lt;Student&gt;();
<a name="l00019"></a><a class="code" href="class_state_forge_1_1_examples_1_1_seminar_1_1_seminar_actuator.html#a0c18c8be8b633dddd71cbd1956c163b8">00019</a>         <span class="keyword">public</span> List&lt;Student&gt; studentList = <span class="keyword">new</span> List&lt;Student&gt;();
<a name="l00020"></a>00020         <span class="keyword">public</span> <span class="keywordtype">int</span> StudentsCount
<a name="l00021"></a><a class="code" href="class_state_forge_1_1_examples_1_1_seminar_1_1_seminar_actuator.html#a3ce3250f63d1117ab95f12ec20cdff88">00021</a>         {
<a name="l00022"></a>00022             <span class="keyword">get</span>
<a name="l00023"></a>00023             {
<a name="l00024"></a>00024                 <span class="keywordflow">return</span> this.studentList.Count;
<a name="l00025"></a>00025             }
<a name="l00026"></a>00026         }
<a name="l00027"></a>00027 
<a name="l00028"></a><a class="code" href="class_state_forge_1_1_examples_1_1_seminar_1_1_seminar_actuator.html#a2d898ba27a25a39956283797183302c4">00028</a>         <span class="keyword">public</span> <span class="keywordtype">int</span> MaxStudents { <span class="keyword">get</span>; <span class="keyword">set</span>; }
<a name="l00029"></a>00029 
<a name="l00030"></a><a class="code" href="class_state_forge_1_1_examples_1_1_seminar_1_1_seminar_actuator.html#ae546d9e143db21c0c6457551e0518d35">00030</a>         <span class="keyword">public</span> <a class="code" href="class_state_forge_1_1_examples_1_1_seminar_1_1_seminar_actuator.html" title="SeminarActuator performs the actions.">SeminarActuator</a>()
<a name="l00031"></a>00031         {
<a name="l00032"></a>00032             MaxStudents = 2;
<a name="l00033"></a>00033         }
<a name="l00034"></a>00034 
<a name="l00035"></a><a class="code" href="class_state_forge_1_1_examples_1_1_seminar_1_1_seminar_actuator.html#a1183f9913787f86ca00cd083a212fa47">00035</a>         <span class="keyword">public</span> <span class="keywordtype">bool</span> IsEmpty()
<a name="l00036"></a>00036         {
<a name="l00037"></a>00037             <span class="keywordflow">return</span> studentList.Count == 0;
<a name="l00038"></a>00038         }
<a name="l00039"></a>00039 
<a name="l00040"></a><a class="code" href="class_state_forge_1_1_examples_1_1_seminar_1_1_seminar_actuator.html#a9a3a3b6e6a498bfd2fd5450db9d7fd49">00040</a>         <span class="keyword">public</span> <span class="keywordtype">bool</span> HasStudentInWaitingList()
<a name="l00041"></a>00041         {
<a name="l00042"></a>00042             <span class="keywordflow">return</span> studentListWaiting.Count &gt; 0;
<a name="l00043"></a>00043         }
<a name="l00044"></a>00044 
<a name="l00045"></a>00045 
<a name="l00046"></a><a class="code" href="class_state_forge_1_1_examples_1_1_seminar_1_1_seminar_actuator.html#aca211afe749b5aeeab6425a88b22655f">00046</a>         <span class="keyword">public</span> <span class="keyword">virtual</span> <span class="keywordtype">void</span> AddStudentInWaitingList(<a class="code" href="class_state_forge_1_1_examples_1_1_seminar_1_1_student.html">Student</a> student)
<a name="l00047"></a>00047         {
<a name="l00048"></a>00048             Console.WriteLine(<span class="stringliteral">&quot;AddStudentInWaitingList {0}&quot;</span>, student.<a class="code" href="class_state_forge_1_1_examples_1_1_seminar_1_1_student.html#a81bc2a8a0a25e3693839ad71acb7c909">Name</a>);
<a name="l00049"></a>00049             studentListWaiting.Add(student);
<a name="l00050"></a>00050         }
<a name="l00051"></a>00051 
<a name="l00052"></a><a class="code" href="class_state_forge_1_1_examples_1_1_seminar_1_1_seminar_actuator.html#a0637196cf0a7352d86135eaafd4ef468">00052</a>         <span class="keyword">public</span> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="_seminar_8fsmcs.html#a7a56923f4b2fd072918c395efe861a1f">ConfirmStudentEnrollment</a>(<a class="code" href="class_state_forge_1_1_examples_1_1_seminar_1_1_student.html">Student</a> student)
<a name="l00053"></a>00053         {
<a name="l00054"></a>00054             Console.WriteLine(<span class="stringliteral">&quot;ConfirmStudentEnrollment {0}&quot;</span>, student.<a class="code" href="class_state_forge_1_1_examples_1_1_seminar_1_1_student.html#a81bc2a8a0a25e3693839ad71acb7c909">Name</a>);
<a name="l00055"></a>00055             studentList.Add(student);
<a name="l00056"></a>00056             studentListWaiting.Remove(student);
<a name="l00057"></a>00057         }
<a name="l00058"></a>00058 
<a name="l00059"></a><a class="code" href="class_state_forge_1_1_examples_1_1_seminar_1_1_seminar_actuator.html#a68b569f869c09cf03c17b5d0d87f58d8">00059</a>         <span class="keyword">public</span> <span class="keyword">virtual</span> <span class="keywordtype">void</span> InformStudentInWaitingList()
<a name="l00060"></a>00060         {
<a name="l00061"></a>00061             Console.WriteLine(<span class="stringliteral">&quot;InformStudentInWaitingList&quot;</span>);
<a name="l00062"></a>00062             <span class="keywordflow">if</span> (studentListWaiting.Count &gt; 0)
<a name="l00063"></a>00063             {
<a name="l00064"></a>00064                 <a class="code" href="class_state_forge_1_1_examples_1_1_seminar_1_1_student.html">Student</a> student = studentListWaiting[0];
<a name="l00065"></a>00065                 <a class="code" href="_seminar_8fsmcs.html#a7a56923f4b2fd072918c395efe861a1f">ConfirmStudentEnrollment</a>(student);
<a name="l00066"></a>00066             }
<a name="l00067"></a>00067         }
<a name="l00068"></a>00068 
<a name="l00069"></a><a class="code" href="class_state_forge_1_1_examples_1_1_seminar_1_1_seminar_actuator.html#accd9ddac06114fc22accd1075a569b2d">00069</a>         <span class="keyword">public</span> <span class="keyword">virtual</span> <span class="keywordtype">void</span> RemoveConfirmedStudent(<a class="code" href="class_state_forge_1_1_examples_1_1_seminar_1_1_student.html">Student</a> student)
<a name="l00070"></a>00070         {
<a name="l00071"></a>00071             Console.WriteLine(<span class="stringliteral">&quot;RemoveConfirmedStudent {0}&quot;</span>, student.<a class="code" href="class_state_forge_1_1_examples_1_1_seminar_1_1_student.html#a81bc2a8a0a25e3693839ad71acb7c909">Name</a>);
<a name="l00072"></a>00072             studentList.Remove(student);
<a name="l00073"></a>00073         }
<a name="l00074"></a>00074 
<a name="l00075"></a><a class="code" href="class_state_forge_1_1_examples_1_1_seminar_1_1_seminar_actuator.html#a01460f42c83d2146e30b5b2917bb85a2">00075</a>         <span class="keyword">public</span> <span class="keyword">virtual</span> <span class="keywordtype">void</span> StartEnrollment()
<a name="l00076"></a>00076         {
<a name="l00077"></a>00077             Console.WriteLine(<span class="stringliteral">&quot;StartEnrollment&quot;</span>);
<a name="l00078"></a>00078         }
<a name="l00079"></a>00079 
<a name="l00080"></a><a class="code" href="class_state_forge_1_1_examples_1_1_seminar_1_1_seminar_actuator.html#adc008c77b1d769b22edc44120f7d3ae3">00080</a>         <span class="keyword">public</span> <span class="keyword">virtual</span> <span class="keywordtype">void</span> StopEnrollment()
<a name="l00081"></a>00081         {
<a name="l00082"></a>00082             Console.WriteLine(<span class="stringliteral">&quot;StopEnrollment&quot;</span>);
<a name="l00083"></a>00083         }
<a name="l00084"></a>00084 
<a name="l00085"></a><a class="code" href="class_state_forge_1_1_examples_1_1_seminar_1_1_seminar_actuator.html#aa0b038f215e5269fb3d0a5c93bef963c">00085</a>         <span class="keyword">public</span> <span class="keyword">virtual</span> <span class="keywordtype">void</span> StartExams()
<a name="l00086"></a>00086         {
<a name="l00087"></a>00087             Console.WriteLine(<span class="stringliteral">&quot;StartExams&quot;</span>);
<a name="l00088"></a>00088         }
<a name="l00089"></a>00089 
<a name="l00090"></a><a class="code" href="class_state_forge_1_1_examples_1_1_seminar_1_1_seminar_actuator.html#a568d3fb224f3f566b6b86cd67f46ca22">00090</a>         <span class="keyword">public</span> <span class="keyword">virtual</span> <span class="keywordtype">void</span> StartTeaching()
<a name="l00091"></a>00091         {
<a name="l00092"></a>00092             Console.WriteLine(<span class="stringliteral">&quot;StartTeaching&quot;</span>);
<a name="l00093"></a>00093         }
<a name="l00094"></a>00094 
<a name="l00095"></a><a class="code" href="class_state_forge_1_1_examples_1_1_seminar_1_1_seminar_actuator.html#ab5f9cc67cfd70e5e3cb8f8e33efba2be">00095</a>         <span class="keyword">public</span> <span class="keyword">virtual</span> <span class="keywordtype">void</span> StopTeaching()
<a name="l00096"></a>00096         {
<a name="l00097"></a>00097             Console.WriteLine(<span class="stringliteral">&quot;StopTeaching&quot;</span>);
<a name="l00098"></a>00098         }
<a name="l00099"></a>00099     }
<a name="l00100"></a>00100 
<a name="l00104"></a><a class="code" href="class_state_forge_1_1_examples_1_1_seminar_1_1_seminar.html">00104</a>     <span class="keyword">public</span> <span class="keyword">partial class </span><a class="code" href="class_state_forge_1_1_examples_1_1_seminar_1_1_seminar.html" title="Seminar is a container class which hold instances of a SeminarActuator and a generated SeminarContext...">Seminar</a>
<a name="l00105"></a>00105     {
<a name="l00106"></a><a class="code" href="class_state_forge_1_1_examples_1_1_seminar_1_1_seminar.html#ad7a9f75d62b45674e63846b19d7d6ff8">00106</a>         <span class="keyword">private</span> <a class="code" href="class_state_forge_1_1_examples_1_1_seminar_1_1_seminar_actuator.html" title="SeminarActuator performs the actions.">SeminarActuator</a> <a class="code" href="class_state_forge_1_1_examples_1_1_seminar_1_1_seminar.html#ad7a9f75d62b45674e63846b19d7d6ff8">actuator</a>;
<a name="l00107"></a><a class="code" href="class_state_forge_1_1_examples_1_1_seminar_1_1_seminar.html#a7ad36ea9588b025ec4e3b7758fe9a846">00107</a>         <span class="keyword">private</span> SeminarContext <a class="code" href="class_state_forge_1_1_examples_1_1_seminar_1_1_seminar.html#a7ad36ea9588b025ec4e3b7758fe9a846">context</a>;
<a name="l00108"></a>00108 
<a name="l00109"></a><a class="code" href="class_state_forge_1_1_examples_1_1_seminar_1_1_seminar.html#a8d0c332159b4177fcae8450f114b2324">00109</a>         <span class="keyword">public</span> <a class="code" href="class_state_forge_1_1_examples_1_1_seminar_1_1_seminar.html" title="Seminar is a container class which hold instances of a SeminarActuator and a generated SeminarContext...">Seminar</a>()
<a name="l00110"></a>00110         {
<a name="l00111"></a>00111             this.actuator = <span class="keyword">new</span> <a class="code" href="class_state_forge_1_1_examples_1_1_seminar_1_1_seminar_actuator.html" title="SeminarActuator performs the actions.">SeminarActuator</a>();
<a name="l00112"></a>00112             this.context = <span class="keyword">new</span> SeminarContext(actuator);
<a name="l00113"></a>00113             this.context.EnterInitialState();
<a name="l00114"></a>00114         }
<a name="l00115"></a>00115 
<a name="l00116"></a><a class="code" href="class_state_forge_1_1_examples_1_1_seminar_1_1_seminar.html#af607d1cddb1300e436f830780499e213">00116</a>         <span class="keyword">static</span> <span class="keywordtype">void</span> Main(<span class="keywordtype">string</span>[] args)
<a name="l00117"></a>00117         {
<a name="l00118"></a>00118             <a class="code" href="class_state_forge_1_1_examples_1_1_seminar_1_1_seminar.html" title="Seminar is a container class which hold instances of a SeminarActuator and a generated SeminarContext...">Seminar</a> mySeminar = <span class="keyword">new</span> <a class="code" href="class_state_forge_1_1_examples_1_1_seminar_1_1_seminar.html" title="Seminar is a container class which hold instances of a SeminarActuator and a generated SeminarContext...">Seminar</a>();
<a name="l00119"></a>00119 
<a name="l00120"></a>00120             <a class="code" href="class_state_forge_1_1_examples_1_1_seminar_1_1_student.html">Student</a> alice = <span class="keyword">new</span> <a class="code" href="class_state_forge_1_1_examples_1_1_seminar_1_1_student.html">Student</a>() { Name = <span class="stringliteral">&quot;Alice&quot;</span> };
<a name="l00121"></a>00121             <a class="code" href="class_state_forge_1_1_examples_1_1_seminar_1_1_student.html">Student</a> beatrice = <span class="keyword">new</span> <a class="code" href="class_state_forge_1_1_examples_1_1_seminar_1_1_student.html">Student</a>() { Name = <span class="stringliteral">&quot;Beatrice&quot;</span> };
<a name="l00122"></a>00122             <a class="code" href="class_state_forge_1_1_examples_1_1_seminar_1_1_student.html">Student</a> carla = <span class="keyword">new</span> <a class="code" href="class_state_forge_1_1_examples_1_1_seminar_1_1_student.html">Student</a>() { Name = <span class="stringliteral">&quot;Carla&quot;</span> };
<a name="l00123"></a>00123 
<a name="l00124"></a>00124             mySeminar.StudentEnrollRequest(alice);
<a name="l00125"></a>00125             mySeminar.StudentEnrollRequest(beatrice);
<a name="l00126"></a>00126             mySeminar.StudentEnrollRequest(carla);
<a name="l00127"></a>00127 
<a name="l00128"></a>00128             mySeminar.StudentDropped(beatrice);
<a name="l00129"></a>00129             mySeminar.StudentDropped(alice);
<a name="l00130"></a>00130 
<a name="l00131"></a>00131             mySeminar.TermStarted();
<a name="l00132"></a>00132             mySeminar.StudentDropped(carla);
<a name="l00133"></a>00133 
<a name="l00134"></a>00134             mySeminar.ClassesEnded();
<a name="l00135"></a>00135             mySeminar.ExamsClosed();
<a name="l00136"></a>00136 
<a name="l00137"></a>00137 
<a name="l00138"></a>00138             Environment.Exit(0);
<a name="l00139"></a>00139         }
<a name="l00140"></a>00140     }
<a name="l00141"></a>00141 }
</pre></div></div>
</div>
﻿<div id="footer">
    <hr />
    <p>
        Copyright &copy; 2011 StateForge.</p>
    <hr />
</div>
</body> </html> 
